Passed
Pull Request — master (#350)
by
unknown
06:30 queued 04:29
created

UserSeeder.run   A

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
1
import { Seeder } from '@concepta/typeorm-seeding';
2
import { UserFactory, JohnFactory } from '../Factories/UserFactory';
3
4
export class UserSeeder extends Seeder {
5
  async run() {
6
    // get a user factory
7
    const userFactory = this.factory(UserFactory);
8
    const johnFactory = this.factory(JohnFactory);
9
    // using defaults
10
    await johnFactory.create();
11
    // with email override
12
    await userFactory.createMany(5);
13
    // persist to database (optional)
14
  }
15
}
16